
(zhcosin/install-package-if-not-found 'auctex)

(load "auctex.el" nil t t)
;;(load "preview-latex.el" nil t t)
(if (string-equal system-type "windows-nt")
	(require 'tex-mik))
	

;; Ask which tex file is master instead of always assume current file is master file.
(setq-default TeX-master nil) ; Query for master file.

(mapc (lambda (mode)
      (add-hook 'LaTeX-mode-hook mode))
      (list 'LaTeX-math-mode
            'turn-on-reftex))

(add-hook 'LaTeX-mode-hook
          (lambda ()
            (setq TeX-auto-untabify t     ; remove all tabs before saving
                  TeX-engine 'xetex       ; use xelatex default
                  TeX-show-compilation t) ; display compilation windows
            (TeX-global-PDF-mode t)       ; PDF mode enable, not plain
            (setq TeX-save-query nil)
            (imenu-add-menubar-index)
            (define-key LaTeX-mode-map (kbd "TAB") 'TeX-complete-symbol)))

(provide 'init-auctex)
